<%@ Register TagPrefix="cc1" Namespace="PHSRAG.Insight21.InsightWebControls" Assembly="PHSRAG.Insight21.InsightWebControls" %>
<%@ Register TagPrefix="cc2" Namespace="PHSRAG.WebControls" Assembly="PHSRAG.WebControls" %>

<%@ Page Language="c#" Inherits="PHSRAG.Insight21.FormsManagement.QuestionnairesPage"
    CodeFile="Questionnaire.aspx.cs" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Questionnaire</title>
    <link href="../Insight21.css" type="text/css" rel="stylesheet" />
</head>
<body>
    <form id="Questionnaire" method="post" runat="server">
        <table class="Container" cellpadding="0">
            <tr>
                <td>
                    <table class="Header" width="100%">
                        <tr>
                            <td>
                                <cc1:Header ID="header" runat="server"></cc1:Header>
                            </td>
                        </tr>
                        <tr style="display: none">
                            <td>
                                <cc1:AdminSubNavigation ID="adminSubNavigation" runat="server" Visible="false"></cc1:AdminSubNavigation>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <cc1:AdminHumansSubNavigation ID="adminHumansSubNavigation" runat="server" Visible="false">
                                </cc1:AdminHumansSubNavigation>
                                <cc1:CoISubNavigation ID="coiSubNavigation" runat="server" Visible="false"></cc1:CoISubNavigation>
                                <cc1:AdminAnimalsSubNavigation ID="adminAnimalsSubNavigation" runat="server" Visible="false">
                                </cc1:AdminAnimalsSubNavigation>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                &nbsp;</td>
                        </tr>
                    </table>
                    <table width="100%" class="Placebar">
                        <tr align="left">
                            <td>
                                <cc2:BreadCrumb ID="breadCrumb" runat="server"></cc2:BreadCrumb>
                            </td>
                        </tr>
                    </table>
                    <table>
                        <tr>
                            <td>
                                <cc2:PostbackGuard ID="postbackGuard" runat="server"></cc2:PostbackGuard>
                            </td>
                        </tr>
                    </table>
                    <table>
                        <tr>
                            <td>
                                <cc2:Annunciator ID="annunciator" runat="server"></cc2:Annunciator>
                            </td>
                        </tr>
                    </table>
                    <asp:Panel ID="questionnairesPanel" runat="server" Visible="True">
                        <table class="FormsManagement" width="100%">
                            <tr>
                                <td>
                                    <cc2:ExpandingPanel ID="helpContainer" runat="server" ExpansionToggler="expansionToggler">
                                        <StaticTemplate>
                                            <table class="Search">
                                                <tr>
                                                    <td>
                                                        <table id="expandedSearch" runat="server">
                                                            <tr>
                                                                <td>
                                                                    <cc2:ExpansionToggler ID="expansionToggler" runat="Server" CollapsedLinkCaption="Show Instructions"
                                                                        ExpandedLinkCaption="Hide Instructions" CollapsedImage="~/Images/Arrow_RT.gif"
                                                                        ExpandedImage="~/Images/Arrow_DN.gif"></cc2:ExpansionToggler>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </table>
                                        </StaticTemplate>
                                        <DynamicTemplate>
                                            <table class="SearchDynamic">
                                                <tr>
                                                    <td>
                                                        &nbsp;</td>
                                                </tr>
                                                <tr>
                                                    <td align="left">
                                                        <ul>
                                                            <li>To create a new questionnaire, click the 'Create Questionnaire' button
                                                                <li>To modify a questionnaire or manage any of a questionnaire's versions, click on
                                                                    the questionnaire's name</li>
                                                        </ul>
                                                    </td>
                                                </tr>
                                            </table>
                                        </DynamicTemplate>
                                    </cc2:ExpandingPanel>
                                </td>
                            </tr>
                        </table>
                        <table class="FormsManagement" width="100%">
                            <tr>
                                <td class="Control">
                                    <asp:Button ID="createQuestionnaire" runat="server" Text="Create Questionnaire" CommandName="createQuestionnaire"
                                        CssClass="Button" OnClick="OnCreateQuestionnaire"></asp:Button></td>
                            </tr>
                            <tr>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td>
                                    <cc2:Pager ID="topPager" runat="server" Visible="false"></cc2:Pager>
                                </td>
                            </tr>
                            <tr>
                                <td class="Control">
                                    <asp:DataGrid ID="questionnaires" runat="server" CssClass="DataGrid" AllowSorting="True"
                                        Width="100%" AutoGenerateColumns="False" AllowPaging="True" AllowCustomPaging="True">
                                        <FooterStyle CssClass="DataGridHeader"></FooterStyle>
                                        <AlternatingItemStyle CssClass="DataGridAlternatingItem"></AlternatingItemStyle>
                                        <ItemStyle CssClass="DataGridItem"></ItemStyle>
                                        <HeaderStyle CssClass="DataGridHeader"></HeaderStyle>
                                        <Columns>
                                            <asp:TemplateColumn Visible="False" HeaderText="ID">
                                                <ItemTemplate>
                                                    <asp:Label ID="questionnaireID" runat="server" Text='<%#DataBinder.Eval(Container, "DataItem.ID")%>'>
                                                    </asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateColumn>
                                            <asp:ButtonColumn DataTextField="Name" HeaderText="Name" SortExpression="Name"></asp:ButtonColumn>
                                            <asp:TemplateColumn HeaderText="Description" SortExpression="Description">
                                                <ItemTemplate>
                                                    <asp:Label ID="qDescription" runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateColumn>
                                            <asp:ButtonColumn DataTextField="TypeMeaning" HeaderText="Type" SortExpression="TypeMeaning">
                                            </asp:ButtonColumn>
                                            <asp:ButtonColumn DataTextField="CategoryMeaning" HeaderText="Category" SortExpression="CategoryMeaning">
                                            </asp:ButtonColumn>
                                            <asp:BoundColumn DataField="CategorySequenceNo" HeaderText="Category Sequence No">
                                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                            </asp:BoundColumn>
                                            <asp:TemplateColumn HeaderText="Active" SortExpression="Active">
                                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                                <ItemTemplate>
                                                    <asp:Label ID="active" runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateColumn>
                                            <asp:TemplateColumn HeaderText="Allow Multiple Questionnaires" SortExpression="AllowMultiple">
                                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                                <ItemTemplate>
                                                    <asp:Label ID="qAllowMultiple" runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateColumn>
                                        </Columns>
                                        <PagerStyle Visible="False"></PagerStyle>
                                    </asp:DataGrid></td>
                            </tr>
                            <tr>
                                <td>
                                    <cc2:Pager ID="bottomPager" runat="server" Visible="false"></cc2:Pager>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <asp:Panel ID="createQuestionnairePanel" runat="server" Visible="False">
                        <table cellspacing="0" cellpadding="0" width="100%">
                            <tr>
                                <td>
                                    <table class="FormsManagement" width="100%">
                                        <tr>
                                            <td>
                                                <cc2:ExpandingPanel ID="helpExpandingpanel" runat="server" ExpansionToggler="helpExpansiontoggler">
                                                    <StaticTemplate>
                                                        <table class="Search">
                                                            <tr>
                                                                <td>
                                                                    <table id="Table1" runat="server">
                                                                        <tr>
                                                                            <td>
                                                                                <cc2:ExpansionToggler ID="helpExpansiontoggler" runat="Server" CollapsedLinkCaption="Show Instructions"
                                                                                    ExpandedLinkCaption="Hide Instructions" CollapsedImage="~/Images/Arrow_RT.gif"
                                                                                    ExpandedImage="~/Images/Arrow_DN.gif"></cc2:ExpansionToggler>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </StaticTemplate>
                                                    <DynamicTemplate>
                                                        <table class="SearchDynamic">
                                                            <tr>
                                                                <td align="left">
                                                                    &nbsp;</td>
                                                            </tr>
                                                            <tr>
                                                                <td align="left">
                                                                    To create a new questionnaire:
                                                                    <ol>
                                                                        <li>Enter a Name; this is a unique abbreviated name for the questionnaire.
                                                                            <li>Enter a Description; this is optional and can be up to 250 characters.
                                                                                <li>Select a Form Type
                                                                                    <li>Select a Category
                                                                                        <li>Enter the Category Sequence No. This is the relative order in which the questionnaire
                                                                                            will appear within the selected category.
                                                                                            <li>Click 'Save' to save and continue.
                                                                                                <li>Click 'Cancel' to return to the Forms Management page without saving the new questionnaire.
                                                                                                </li>
                                                                    </ol>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </DynamicTemplate>
                                                </cc2:ExpandingPanel>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                        <table>
                            <tr>
                                <td colspan="3">
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td align="right">
                                    Name:</td>
                                <td>
                                    <img alt="Clear" src="../Images/clear.gif" width="2" /></td>
                                <td style="white-space:nowrap">
                                    <asp:TextBox ID="questionnaireName" Visible="True" runat="server" CssClass="FlatTextBox"
                                        Columns="50" MaxLength="50"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="nameValidator" runat="server" ErrorMessage="Name cannot be left empty"
                                        ControlToValidate="questionnaireName" Display="Dynamic"></asp:RequiredFieldValidator></td>
                            </tr>
                            <tr>
                                <td>
                                    <img alt="Clear" height="2" src="../Images/clear.gif" /></td>
                            </tr>
                            <tr>
                                <td align="right">
                                    Description:</td>
                                <td>
                                </td>
                                <td>
                                    <asp:TextBox ID="questionnaireDescription" runat="server" Visible="True" CssClass="FlatTextBox"
                                        Columns="50" MaxLength="250" Rows="5" TextMode="MultiLine"></asp:TextBox></td>
                            </tr>
                            <tr>
                                <td>
                                    <img alt="Clear" height="2" src="../Images/clear.gif" /></td>
                            </tr>
                            <tr>
                                <td align="right">
                                    Form Type:</td>
                                <td>
                                </td>
                                <td>
                                    <asp:DropDownList ID="questionnaireType" runat="server" CssClass="FlatDropDown" AutoPostBack="True"
                                        OnSelectedIndexChanged="OnQuestionnaireTypeSelectedIndexChanged">
                                    </asp:DropDownList></td>
                            </tr>
                            <tr>
                                <td>
                                    <img alt="Clear" height="2" src="../Images/clear.gif" /></td>
                            </tr>
                            <tr>
                                <td align="right">
                                    Category:</td>
                                <td>
                                </td>
                                <td>
                                    <asp:DropDownList ID="questionnaireCategory" runat="server" CssClass="FlatDropDown">
                                    </asp:DropDownList></td>
                            </tr>
                            <tr>
                                <td>
                                    <img alt="Clear" height="2" src="../Images/clear.gif" /></td>
                            </tr>
                            <tr>
                                <td align="right">
                                    Category Sequence No:</td>
                                <td>
                                </td>
                                <td style="white-space:nowrap">
                                    <asp:TextBox ID="questionnaireCategorySequenceNo" runat="server" CssClass="FlatTextBox"
                                        Columns="4" MaxLength="4"></asp:TextBox>
                                    <asp:RegularExpressionValidator ID="sequenceValidator" runat="server" ErrorMessage="Category Sequence No should be a number"
                                        ControlToValidate="questionnaireCategorySequenceNo" ValidationExpression="\d+"></asp:RegularExpressionValidator></td>
                            </tr>
                            <tr>
                                <td>
                                    <img alt="Clear" height="2" src="../Images/clear.gif" /></td>
                            </tr>
                            <tr>
                                <td align="right">
                                    Allow Multiple:</td>
                                <td>
                                </td>
                                <td align="left">
                                    <asp:CheckBox ID="questionnaireAllowMultiple" runat="server" Text=""></asp:CheckBox></td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td>
                                    &nbsp;</td>
                                <td>
                                </td>
                                <td>
                                    <table>
                                        <tr>
                                            <td>
                                                <asp:Button ID="cancelNewQuestionnaire" Visible="True" runat="server" Text="Cancel"
                                                    CommandName="cancelNewQuestionnaire" CssClass="FixedWidthButton" CausesValidation="False"
                                                    OnClick="OnCancelQuestionnaire"></asp:Button></td>
                                            <td>
                                                <img alt="Clear" height="1" src="../Images/clear.gif" width="50" /></td>
                                            <td>
                                                <asp:Button ID="saveNewQuestionnaire" Visible="True" runat="server" Text="Save" CommandName="saveNewQuestionnaire"
                                                    CssClass="FixedWidthButton" OnClick="OnSaveQuestionnaire"></asp:Button></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <cc2:SetFocus ID="setFocus" runat="server" FocusControl="questionnaireName"></cc2:SetFocus>
                </td>
            </tr>
        </table>
    </form>
</body>
</html>
